package com.zxc.shortlink.component;

import org.springframework.stereotype.Component;

import javax.annotation.Resource;
import java.util.concurrent.ThreadPoolExecutor;

/**
* @author zxc_user
* @date 2022/3/24 14:47
* @version 1.0
* @description 线程池工具类
**/
@Component
public class ThreadPoolComponent {

    @Resource(name = "ordinaryThreadPool")
    private ThreadPoolExecutor ordinaryPoolExecutor;

    @Resource(name = "shortLinkThreadPool")
    private ThreadPoolExecutor shortLinkThreadPool;

    /**
     * 普通线程池
     * @return
     */
    public ThreadPoolExecutor getOrdinaryPoolExecutor() {
        return ordinaryPoolExecutor;
    }

    /**
     * 短链接线程池
     * @return
     */
    public ThreadPoolExecutor getShortLinkThreadPool() {
        return shortLinkThreadPool;
    }
}
